(defvar *deli* '(#\space  #\tab  #\newline))
(defun get-word (str &optional ch)
	(let ((len (length str))(start 0)(stop 0)(flag nil)(delimeter nil))
		(if (null ch) (setf delimeter *deli*) (setf delimeter (list ch)))
		(dotimes (i len)
			(if (member (char str i) delimeter)
				(if (eql flag T) (progn (setf stop i)(return)))
				(if (null flag)  (progn (setf flag T)(setf start i)))
			)
		)
		(if (eql flag T)
		    (if (= stop 0) (setf stop len)))
		(if (null str)
		    (values "" 0)
		    (if (and (= start 0) (= stop 0))
			(values (subseq str start stop) len)
			(values (subseq str start stop) stop)))))
					
(defun left-str(str)
  (if (null str)
      (values "")
      (subseq str (multiple-value-bind (s l) (get-word str) (eval l)) (length str))))
(defun get-exp (str)
	(left-str str))

(defun get-wd(str ch)
	(get-word (get-word str ch)))

(defun left-wd(str ch)
  (let ((s nil)(l 0)(len (length str)))
    (multiple-value-setq (s l) (get-word str ch))
    (if (>= l len)
	nil
	(get-word (subseq str (1+ l) (length str))))))

(defun get-list(str)
	(format nil " (~a)" str))

(defun get-field(str)
	(do ((ss (left-str str) (left-str ss))(fl nil)(vl nil)(s nil))
		((= (length ss) 0)(values (get-list fl) (get-list vl)))
			(setf s (string-trim *deli* (get-word ss)))
			(if (null fl) (setf fl (get-wd s #\=)) (setf fl (concatenate 'string fl "," (get-wd s #\=))))             
			(if (null vl) (setf vl (left-wd s #\=)) (setf vl (concatenate 'string vl "," (left-wd s #\=))))
	)
)	

(defun get-values(str)
	(multiple-value-bind (f v) (get-field str) (eval v)))
		                   			 